<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->increments('id');
            $table->string('user_id', 20)->default('')->comment('用户ID');
            $table->string('shop_id', 20)->default('')->comment('商户ID');
            $table->enum('day_enabled', ['true', 'false'])->default('true')->comment('打开、关闭天天红包');
            $table->enum('mal_enabled', ['true', 'false'])->default('true')->comment('打开、关闭手动红包');
            $table->enum('luck_enabled', ['true', 'false'])->default('true')->comment('打开、关闭幸运红包');
            $table->decimal('total_amount', 38, 4)->default(0)->comment('积分总数');
            $table->integer('cumulative')->default(0)->comment('累计消费');
            $table->integer('create_time')->default(0)->comment('创建时间');
            $table->integer('update_time')->default(0)->comment('更新时间');
            // 索引
            $table->index('shop_id');
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
